package com.qingyun.customview

import android.os.Bundle
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.qingyun.customview.autosearch.EditTextActivity
import com.qingyun.customview.bezier.BezierActivity
import com.qingyun.customview.dragview.DrawViewActivity
import com.qingyun.customview.draw.MyDrawActivity
import com.qingyun.customview.flowlayout.ExpandableFlowLayoutActivity
import com.qingyun.customview.hencode.practice1.Practice1MainActivity
import com.qingyun.customview.nestscroll1.MyNestScrollViewActivity
import com.qingyun.customview.progress.ProgressActivity

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
    }

    fun onClick(view: View) {
        when (view.id) {
            R.id.btnProgress -> {
                ProgressActivity.start(this)
            }

            R.id.btnBezier -> {
                BezierActivity.start(this)
            }

            R.id.btnFlowLayout -> {
                ExpandableFlowLayoutActivity.start(this)
            }

            R.id.btnEditText -> {
                EditTextActivity.start(this)
            }

            R.id.btnHencodePractice1 -> {
                Practice1MainActivity.start(this)
            }

            R.id.btnNestScrollView1 -> {
                MyNestScrollViewActivity.start(this)
            }

            R.id.btnDragView -> {
                DrawViewActivity.start(this)
            }

            R.id.btnDraw -> {
                MyDrawActivity.start(this)
            }

            else -> {}
        }
    }
}